package com.heima.auth.controller;

import com.heima.auth.common.result.ResponseResult;
import com.heima.auth.pojo.AuthContent;
import com.heima.auth.pojo.ScanResult;
import com.heima.auth.pojo.WmNews;
import com.heima.auth.service.AuthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;

@RestController
@RequestMapping("/api/v1/auth")
@Api(value = "内容安全审核接口Controller",tags = "内容安全审核接口Controller")
public class AuthController {
    @Autowired
    AuthService authService;
    @PostMapping("/news")
    @ApiOperation(value = "文章审核",notes = "基于news文章，获取文本内容 图片内容，分别调用阿里云内容安全接口进行审核")
    public ResponseResult<ScanResult> authNews(@RequestBody WmNews wmNews){
        return authService.wmNewsAuth(wmNews);
    }
    @PostMapping("/news/textAuth")
    @ApiOperation(value = "文章审核",notes = "基于news文章，阿里云审核文本内容")
    public ResponseResult<ScanResult> authNewsText(@RequestBody AuthContent authContent){
        return authService.wmNewsAuthText(authContent);
    }
    @PostMapping("/news/imageAuth")
    @ApiOperation(value = "文章审核",notes = "基于news文章，阿里云审核图片内容")
    public ResponseResult<ScanResult> authNewsImage(@RequestBody AuthContent authContent){
        return authService.wmNewsAuthImages(authContent);
    }
}
